<html>
<head>
    <title>欢迎使用SN-generator&nbsp;Web工具</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <script src="/common/js/jquery-1.7.1.min.js"></script>
    <script src="/common/js/jquery.base64.js"></script>
</head>
<body>
<br>
<br>
<span style="font-size: 30px;">生成API层</span>
<br>
<br>
<hr>
请输入配置信息:<br>
请输入基础路径(即SN-parent文件夹的位置):<br><input id="basePath" style="width:800px" value="E:/work/GFS_NEW_IntenlliJ/SN/branches/SN-parent_0.0.1_BR"><br>
<br>
请输入apiProjectName(即inapi或者outapi):<br><select id="apiProjectName"><option value="inapi">inapi</option><option value="outapi">outapi</option></select><br>
<br>
请输入apiName(即英文接口名称):<br><input id="apiName" style="width:800px" value="Test"><br>
<br>
请输入apiDesc(即中文接口名称):<br><input id="apiDesc" style="width:800px" value="金融系统测试"><br>
<br><br>
请输入该接口提供的服务列表:<br>
<textarea id="buildproperties" style="width:800px;height:200px;">
serviceA
serviceB
serviceB
</textarea><br><br><br>
<span>
使用说明:<br>

</span>
<input id="CCC" type="button" onclick="buildFiles()" value="点击生成"/>
<script>
    function buildFiles(){
        if(!confirm("是否确定生成!")){
            return;
        }
        var basePath = $("#basePath").val();
        var apiProjectName = $("#apiProjectName").val()
        var apiName = $("#apiName").val()
        var apiDesc = $("#apiDesc").val()
        var buildproperties = $("#buildproperties").val();

        basePath = $.base64.encode(encodeURI(basePath));
        buildproperties = $.base64.encode(encodeURI(buildproperties));

        var buildurl ="/generatorapi"
                +"?basePath="+basePath
                +"&apiProjectName="+apiProjectName
                +"&apiName="+apiName
                +"&apiDesc="+encodeURI(apiDesc)
                +"&buildproperties="+buildproperties;

        $.ajax({
            url: buildurl,
            type: "GET",
            dataType: "json",
            success: function (data) {
                if(data.resCode=="0000"){
                    alert("成功");
                }else{
                    alert("生成失败，错误原因如下:"+data.resDesc)
                }
            }
        });
    }
</script>
</body>
</html>